import sqlite3
import pandas as pd
import mplfinance as mpf 

with sqlite3.connect('example.db') as conn:
    df = pd.read_sql("select * from stock_zh_a_hist_df_002642",conn)
    df['日期'] = pd.to_datetime(df['日期'])
    df.set_index('日期',inplace=True)

    df = df[['开盘','最高','最低','收盘','成交额']]
    df.columns = ['Open','High','Low','Close','Volume']
    print(df.head())
    mpf.plot(df,type='candle',style='charles',volume=True,mav=(5,10,20))
    
    


    

